using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class Debit_Credit_MemoMap : EntityTypeConfiguration<Debit_Credit_Memo>
    {
        public Debit_Credit_MemoMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Reference)
                .HasMaxLength(10);

            this.Property(t => t.Ticket_number)
                .HasMaxLength(10);

            this.Property(t => t.Crpartyid)
                .HasMaxLength(6);

            this.Property(t => t.Dbpartyid)
                .HasMaxLength(6);

            this.Property(t => t.Credit_Acct)
                .HasMaxLength(40);

            this.Property(t => t.Debit_Acct)
                .HasMaxLength(40);

            this.Property(t => t.DBpartytype)
                .HasMaxLength(4);

            this.Property(t => t.CRpartytype)
                .HasMaxLength(4);

            this.Property(t => t.Desc)
                .HasMaxLength(100);

            this.Property(t => t.Desc2)
                .HasMaxLength(100);

            this.Property(t => t.Vglbatch)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.voucherNumber)
                .HasMaxLength(8);

            this.Property(t => t.DBCR)
                .HasMaxLength(2);

            // Table & Column Mappings
            this.ToTable("Debit_Credit_Memo");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Reference).HasColumnName("Reference");
            this.Property(t => t.Ticket_number).HasColumnName("Ticket_number");
            this.Property(t => t.Crpartyid).HasColumnName("Crpartyid");
            this.Property(t => t.Dbpartyid).HasColumnName("Dbpartyid");
            this.Property(t => t.Credit_Acct).HasColumnName("Credit_Acct");
            this.Property(t => t.Debit_Acct).HasColumnName("Debit_Acct");
            this.Property(t => t.DBpartytype).HasColumnName("DBpartytype");
            this.Property(t => t.CRpartytype).HasColumnName("CRpartytype");
            this.Property(t => t.Desc).HasColumnName("Desc");
            this.Property(t => t.Desc2).HasColumnName("Desc2");
            this.Property(t => t.Vglbatch).HasColumnName("Vglbatch");
            this.Property(t => t.Closed).HasColumnName("Closed");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.voucherNumber).HasColumnName("voucherNumber");
            this.Property(t => t.DBCR).HasColumnName("DBCR");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.UserID).HasColumnName("UserID");
        }
    }
}
